```html
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Spring AI 框架全解析 | 现代AI集成开发指南</title>
    <link rel="stylesheet" href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', 'Noto Serif SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            color: #333;
            line-height: 1.8;
            background-color: #f9f9f9;
        }
        .hero-gradient {
            background: linear-gradient(135deg, #6e8efb 0%, #a777e3 100%);
        }
        .card-hover:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
        }
        .highlight-box {
            background: linear-gradient(to right, rgba(110, 142, 251, 0.1), rgba(167, 119, 227, 0.1));
            border-left: 4px solid #6e8efb;
        }
        .code-block {
            background-color: #2d2d2d;
            color: #f8f8f2;
            border-radius: 8px;
            overflow: hidden;
        }
        .model-card {
            transition: all 0.3s ease;
            border-top: 3px solid;
        }
        .model-card:hover {
            transform: translateY(-3px);
        }
        .first-letter {
            font-size: 3.5rem;
            line-height: 1;
            float: left;
            margin-right: 0.5rem;
            margin-bottom: -0.5rem;
            color: #6e8efb;
            font-weight: 700;
        }
    </style>
</head>
<body class="antialiased">
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20 px-4 md:py-32">
        <div class="container mx-auto max-w-6xl px-4">
            <div class="flex flex-col md:flex-row items-center">
                <div class="md:w-1/2 mb-10 md:mb-0">
                    <h1 class="text-4xl md:text-5xl lg:text-6xl font-bold leading-tight mb-6">
                        Spring AI <span class="text-indigo-200">框架全解析</span>
                    </h1>
                    <p class="text-xl md:text-2xl text-indigo-100 mb-8 max-w-lg">
                        现代Java开发者集成AI功能的一站式解决方案
                    </p>
                    <div class="flex flex-wrap gap-4">
                        <button class="bg-white text-indigo-600 hover:bg-indigo-50 px-6 py-3 rounded-lg font-semibold transition-all duration-300 transform hover:-translate-y-1 shadow-md">
                            <i class="fas fa-book mr-2"></i> 快速开始
                        </button>
                        <button class="bg-transparent border-2 border-white text-white hover:bg-white hover:text-indigo-600 px-6 py-3 rounded-lg font-semibold transition-all duration-300">
                            <i class="fas fa-download mr-2"></i> 获取源码
                        </button>
                    </div>
                </div>
                <div class="md:w-1/2 flex justify-center">
                    <div class="relative w-full max-w-md">
                        <div class="absolute -top-6 -left-6 w-32 h-32 bg-purple-300 rounded-full mix-blend-multiply filter blur-xl opacity-70 animate-blob"></div>
                        <div class="absolute -bottom-8 -right-8 w-32 h-32 bg-pink-300 rounded-full mix-blend-multiply filter blur-xl opacity-70 animate-blob animation-delay-2000"></div>
                        <div class="absolute top-20 -right-10 w-32 h-32 bg-indigo-300 rounded-full mix-blend-multiply filter blur-xl opacity-70 animate-blob animation-delay-4000"></div>
                        <div class="relative bg-white bg-opacity-10 backdrop-filter backdrop-blur-lg p-8 rounded-2xl shadow-2xl border border-white border-opacity-20">
                            <div class="text-center">
                                <i class="fas fa-robot text-5xl mb-4 text-white opacity-90"></i>
                                <h3 class="text-xl font-semibold mb-2">AI集成革命</h3>
                                <p class="text-indigo-100 mb-4">Spring生态系统的最新力作</p>
                                <div class="flex justify-center space-x-2">
                                    <span class="px-3 py-1 bg-white bg-opacity-20 rounded-full text-sm font-medium">Java</span>
                                    <span class="px-3 py-1 bg-white bg-opacity-20 rounded-full text-sm font-medium">AI</span>
                                    <span class="px-3 py-1 bg-white bg-opacity-20 rounded-full text-sm font-medium">Spring</span>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto max-w-6xl px-4 py-12">
        <!-- Section 1: Overview -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-12 bg-indigo-100 rounded-lg flex items-center justify-center mr-4">
                    <i class="fas fa-layer-group text-indigo-600 text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">1. Spring AI 框架概览</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover transition-all duration-300">
                    <img src="https://cdn.nlark.com/yuque/0/2025/png/21449790/1749118602764-521ec6ea-6df6-4857-9e5f-2e6c74c3b0a6.png" alt="Spring AI 架构图" class="w-full h-48 object-cover">
                    <div class="p-6">
                        <h3 class="text-xl font-bold mb-3 text-gray-800">SpringAI核心特性</h3>
                        <ul class="space-y-2 text-gray-600">
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                <span>统一抽象层：提供一致的API接口</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                <span>模块化设计：可按需引入功能模块</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                <span>生产级特性：重试机制、速率限制等</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                <span>流式处理：提升用户体验</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check-circle text-indigo-500 mt-1 mr-2"></i>
                                <span>提示管理：结构化模板系统</span>
                            </li>
                        </ul>
                    </div>
                </div>
                
                <div class="bg-white rounded-xl shadow-md overflow-hidden card-hover transition-all duration-300">
                    <div class="p-6">
                        <h3 class="text-xl font-bold mb-3 text-gray-800">支持的AI服务与模型</h3>
                        
                        <div class="space-y-4">
                            <div class="model-card bg-white p-4 rounded-lg shadow-sm border-t-indigo-500">
                                <div class="flex items-center mb-2">
                                    <div class="w-8 h-8 bg-indigo-100 rounded-full flex items-center justify-center mr-3">
                                        <i class="fas fa-brain text-indigo-600"></i>
                                    </div>
                                    <h4 class="font-bold text-gray-800">OpenAI</h4>
                                </div>
                                <p class="text-sm text-gray-600">GPT-3.5-turbo, GPT-4等，功能全面，性能优异</p>
                            </div>
                            
                            <div class="model-card bg-white p-4 rounded-lg shadow-sm border-t-blue-500">
                                <div class="flex items-center mb-2">
                                    <div class="w-8 h-8 bg-blue-100 rounded-full flex items-center justify-center mr-3">
                                        <i class="fas fa-cloud text-blue-600"></i>
                                    </div>
                                    <h4 class="font-bold text-gray-800">Azure OpenAI</h4>
                                </div>
                                <p class="text-sm text-gray-600">企业级安全性和合规性，数据隐私保护</p>
                            </div>
                            
                            <div class="model-card bg-white p-4 rounded-lg shadow-sm border-t-purple-500">
                                <div class="flex items-center mb-2">
                                    <div class="w-8 h-8 bg-purple-100 rounded-full flex items-center justify-center mr-3">
                                        <i class="fas fa-shield-alt text-purple-600"></i>
                                    </div>
                                    <h4 class="font-bold text-gray-800">Anthropic Claude</h4>
                                </div>
                                <p class="text-sm text-gray-600">长上下文窗口，擅长详细解释和遵循指令</p>
                            </div>
                            
                            <div class="model-card bg-white p-4 rounded-lg shadow-sm border-t-green-500">
                                <div class="flex items-center mb-2">
                                    <div class="w-8 h-8 bg-green-100 rounded-full flex items-center justify-center mr-3">
                                        <i class="fas fa-lock text-green-600"></i>
                                    </div>
                                    <h4 class="font-bold text-gray-800">Ollama</h4>
                                </div>
                                <p class="text-sm text-gray-600">支持本地部署开源模型，无需外部API调用</p>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="bg-white rounded-xl shadow-md p-6 mb-8">
                <h3 class="text-xl font-bold mb-4 text-gray-800">与Spring生态的无缝集成</h3>
                <div class="grid md:grid-cols-2 lg:grid-cols-4 gap-4">
                    <div class="flex items-start p-3 bg-gray-50 rounded-lg">
                        <i class="fas fa-bolt text-indigo-500 mt-1 mr-3"></i>
                        <div>
                            <h4 class="font-semibold text-gray-800">Spring Boot</h4>
                            <p class="text-sm text-gray-600">通过starter依赖快速引入</p>
                        </div>
                    </div>
                    <div class="flex items-start p-3 bg-gray-50 rounded-lg">
                        <i class="fas fa-database text-indigo-500 mt-1 mr-3"></i>
                        <div>
                            <h4 class="font-semibold text-gray-800">Spring Data</h4>
                            <p class="text-sm text-gray-600">简化向量数据库操作</p>
                        </div>
                    </div>
                    <div class="flex items-start p-3 bg-gray-50 rounded-lg">
                        <i class="fas fa-shield-alt text-indigo-500 mt-1 mr-3"></i>
                        <div>
                            <h4 class="font-semibold text-gray-800">Spring Security</h4>
                            <p class="text-sm text-gray-600">保护AI接口和敏感数据</p>
                        </div>
                    </div>
                    <div class="flex items-start p-3 bg-gray-50 rounded-lg">
                        <i class="fas fa-network-wired text-indigo-500 mt-1 mr-3"></i>
                        <div>
                            <h4 class="font-semibold text-gray-800">Spring Cloud</h4>
                            <p class="text-sm text-gray-600">分布式部署AI能力</p>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="mermaid">
                graph TD
                    A[Spring AI] --> B[模型调用]
                    A --> C[向量存储]
                    A --> D[提示管理]
                    B --> E[OpenAI]
                    B --> F[Azure OpenAI]
                    B --> G[Anthropic]
                    C --> H[Redis]
                    C --> I[Pinecone]
                    C --> J[Chroma]
                    D --> K[模板系统]
                    D --> L[变量替换]
            </div>
        </section>
        
        <!-- Section 2: Environment Setup -->
        <section class="mb-20">
            <div class="flex items-center mb-8">
                <div class="w-12 h-12 bg-indigo-100 rounded-lg flex items-center justify-center mr-4">
                    <i class="fas fa-cogs text-indigo-600 text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">2. 开发环境准备</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div>
                    <h3 class="text-xl font-bold mb-4 text-gray-800">Maven/Gradle依赖配置</h3>
                    
                    <div class="mb-6">
                        <h4 class="font-semibold mb-2 text-gray-700 flex items-center">
                            <i class="fas fa-code-branch text-indigo-500 mr-2"></i> Maven配置
                        </h4>
                        <div class="code-block rounded-lg overflow-hidden">
                            <pre class="p-4 text-sm overflow-x-auto"><code class="language-xml">&lt;!-- Spring Boot 父依赖 --&gt;
&lt;parent&gt;
    &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
    &lt;artifactId&gt;spring-boot-starter-parent&lt;/artifactId&gt;
    &lt;version&gt;3.2.0&lt;/version&gt;
&lt;/parent&gt;
&lt;dependencies&gt;
    &lt;!-- Spring Boot Web --&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
        &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
    &lt;/dependency&gt;
    
    &lt;!-- 选择一个或多个模型提供商 --&gt;
    &lt;!-- OpenAI --&gt;
    &lt;dependency&gt;
        &lt;groupId&gt;org.springframework.ai&lt;/groupId&gt;
        &lt;artifactId&gt;spring-ai-openai-spring-boot-starter&lt;/artifactId&gt;
    &lt;/dependency&gt;
&lt;/dependencies&gt;</code></pre>
                        </div>
                    </div>
                    
                    <div>
                        <h4 class="font-semibold mb-2 text-gray-700 flex items-center">
                            <i class="fas fa-code-branch text-indigo-500 mr-2"></i> Gradle配置
                        </h4>
                        <div class="code-block rounded-lg overflow-hidden">
                            <pre class="p-4 text-sm overflow-x-auto"><code class="language-groovy">plugins {
    id 'org.springframework.boot' version '3.2.0'
    id 'io.spring.dependency-management' version '1.1.4'
    id 'java'
}

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-web'
    implementation 'org.springframework.ai:spring-ai-openai-spring-boot-starter'
}</code></pre>
                        </div>
                    </div>
                </div>
                
                <div>
                    <h3 class="text-xl font-bold mb-4 text-gray-800">API密钥管理最佳实践</h3>
                    
                    <div class="highlight-box p-5 rounded-lg mb-6">
                        <h4 class="font-semibold mb-3 text-gray-800 flex items-center">
                            <i class="fas fa-key text-indigo-500 mr-2"></i> 安全存储API密钥
                        </h4>
                        <ul class="space-y-2 text-gray-700">
                            <li class="flex items-start">
                                <i class="fas fa-check text-indigo-500 mt-1 mr-2"></i>
                                <span>使用环境变量而非硬编码</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check text-indigo-500 mt-1 mr-2"></i>
                                <span>通过Spring Cloud Config集中管理</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check text-indigo-500 mt-1 mr-2"></i>
                                <span>使用Vault等密钥管理服务</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check text-indigo-500 mt-1 mr-2"></i>
                                <span>开发环境使用.gitignore文件</span>
                            </li>
                            <li class="flex items-start">
                                <i class="fas fa-check text-indigo-500 mt-1 mr-2"></i>
                                <span>实施密钥轮换策略</span>
                            </li>
                        </ul>
                    </div>
                    
                    <div class="code-block rounded-lg overflow-hidden">
                        <pre class="p-4 text-sm overflow-x-auto"><code class="language-yaml"># application.yml 配置示例
spring:
  ai:
    openai:
      api-key: ${OPENAI_API_KEY}
      base-url: https://api.openai.com/</code></pre>
                    </div>
                </div>
            </div>
            
            <div class="mermaid">
                flowchart LR
                    A[API密钥来源] --> B[环境变量]
                    A --> C[配置中心]
                    A --> D[Vault服务]
                    B --> E[应用配置]
                    C --> E
                    D --> E
                    E --> F[Spring AI]
            </div>
        </section>
        
        <!-- Section 3: First Application -->
        <section>
            <div class="flex items-center mb-8">
                <div class="w-12 h-12 bg-indigo-100 rounded-lg flex items-center justify-center mr-4">
                    <i class="fas fa-laptop-code text-indigo-600 text-xl"></i>
                </div>
                <h2 class="text-3xl font-bold text-gray-800">3. 第一个Spring AI应用</h2>
            </div>
            
            <div class="grid md:grid-cols-2 gap-8 mb-12">
                <div>
                    <h3 class="text-xl font-bold mb-4 text-gray-800">项目创建与配置</h3>
                    
                    <div class="mb-6">
                        <p class="text-gray-600 mb-4">使用Spring Initializr创建项目，选择Spring Web和Spring AI OpenAI Starter依赖。</p>
                        
                        <div class="highlight-box p-5 rounded-lg mb-4">
                            <h4 class="font-semibold mb-2 text-gray-800 flex items-center">
                                <i class="fas fa-cog text-indigo-500 mr-2"></i> 主应用类
                            </h4>
                            <div class="code-block rounded-lg overflow-hidden">
                                <pre class="p-4 text-sm overflow-x-auto"><code class="language-java">@SpringBootApplication
public class AiApplication {
    public static void main(String[] args) {
        SpringApplication.run(AiApplication.class, args);
    }
}</code></pre>
                            </div>
                        </div>
                        
                        <div class="highlight-box p-5 rounded-lg">
                            <h4 class="font-semibold mb-2 text-gray-800 flex items-center">
                                <i class="fas fa-sliders-h text-indigo-500 mr-2"></i> 配置类
                            </h4>
                            <div class="code-block rounded-lg overflow-hidden">
                                <pre class="p-4 text-sm overflow-x-auto"><code class="language-java">@Configuration
public class OpenAiChatConfig {
    @Bean
    public OpenAiChatClient openAiChatClient(
        @Value("${spring.ai.openai.api-key}") String apiKey) {
        return new OpenAiChatClient(apiKey);
    }
}</code></pre>
                            </div>
                        </div>
                    </div>
                </div>
                
                <div>
                    <h3 class="text-xl font-bold mb-4 text-gray-800">实现对话功能</h3>
                    
                    <div class="mb-6">
                        <h4 class="font-semibold mb-2 text-gray-700 flex items-center">
                            <i class="fas fa-comments text-indigo-500 mr-2"></i> 服务层
                        </h4>
                        <div class="code-block rounded-lg overflow-hidden">
                            <pre class="p-4 text-sm overflow-x-auto"><code class="language-java">@Service
public class OpenAiChatService {
    @Autowired
    private OpenAiChatClient chatClient;

    public String easyChat(String message) {
        return chatClient.call(message);
    }
}</code></pre>
                        </div>
                    </div>
                    
                    <div>
                        <h4 class="font-semibold mb-2 text-gray-700 flex items-center">
                            <i class="fas fa-plug text-indigo-500 mr-2"></i> REST控制器
                        </h4>
                        <div class="code-block rounded-lg overflow-hidden">
                            <pre class="p-4 text-sm overflow-x-auto"><code class="language-java">@RestController
@RequestMapping("/ai")
public class ChatController {
    @Autowired
    private OpenAiChatService chatService;

    @GetMapping("/chat")
    public String chat(@RequestParam String message) {
        return chatService.easyChat(message);
    }
}</code></pre>
                        </div>
                    </div>
                </div>
            </div>
            
            <div class="bg-white rounded-xl shadow-md p-6">
                <h3 class="text-xl font-bold mb-4 text-gray-800">测试与问题排查</h3>
                
                <div class="grid md:grid-cols-2 gap-6">
                    <div>
                        <h4 class="font-semibold mb-3 text-gray-700 flex items-center">
                            <i class="fas fa-bug text-indigo-500 mr-2"></i> 常见问题
                        </h4>
                        <ul class="space-y-3 text-gray-600">
                            <li class="flex items-start">
                                <div class="bg-red-100 text-red-600 rounded-full w-6 h-6 flex items-center justify-center mr-2">
                                    <i class="fas fa-exclamation text-xs"></i>
                                </div>
                                <span>API密钥未正确设置</span>
                            </li>
                            <li class="flex items-start">
                                <div class="bg-yellow-100 text-yellow-600 rounded-full w-6 h-6 flex items-center justify-center mr-2">
                                    <i class="fas fa-clock text-xs"></i>
                                </div>
                                <span>请求超时或速率限制</span>
                            </li>
                            <li class="flex items-start">
                                <div class="bg-blue-100 text-blue-600 rounded-full w-6 h-6 flex items-center justify-center mr-2">
                                    <i class="fas fa-microchip text-xs"></i>
                                </div>
                                <span>内存不足导致崩溃</span>
                            </li>
                            <li class="flex items-start">
                                <div class="bg-purple-100 text-purple-600 rounded-full w-6 h-6 flex items-center justify-center mr-2">
                                    <i class="fas fa-code-branch text-xs"></i>
                                </div>
                                <span>依赖版本冲突</span>
                            </li>
                        </ul>
                    </div>
                    
                    <div>
                        <h4 class="font-semibold mb-3 text-gray-700 flex items-center">
                            <i class="fas fa-tools text-indigo-500 mr-2"></i> 调试工具
                        </h4>
                        <div class="code-block rounded-lg overflow-hidden">
                            <pre class="p-4 text-sm overflow-x-auto"><code class="language-bash"># 启用调试日志
logging.level.org.springframework.ai=DEBUG

# 测试API端点
curl "http://localhost:8080/ai/chat?message=你好"</code></pre>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </main>

    <script>
        mermaid.initialize({
            startOnLoad: true,
            theme: 'default',
            flowchart: {
                useMaxWidth: true,
                htmlLabels: true,
                curve: 'basis'
            }
        });
    </script>
</body>
</html>
```